% read csv file
clear all
% close all
fclose all

path1='C:\Users\Tom�s\Desktop\Temp\';


fileName='region_counts_WGR.csv';
% opts = spreadsheetImportOptions('Sheet',1)


M = readcell([path1 fileName],'NumHeaderLines',1);
for i=1:size(M,1)-1
    
%organize variable lobule
    Lobule{i}=M{i,1};
    
%organize variable Candelabrum (number of cells)
    if ischar(M{i,2})
        Candelabrum(i)=nan;
    else
        Candelabrum(i)=M{i,2};
    end
    
%organize variable Globular (number of cells)
    if ischar(M{i,3})
        Globular(i)=nan;
    else
        Globular(i)=M{i,3};
    end
    
  %organize variable Golgi1 (number of cells)
    if ischar(M{i,4})
        Golgi1(i)=nan;
    else
        Golgi1(i)=M{i,4};
    end   
    
 %organize variable MLI1_1 (number of cells)
    if ischar(M{i,5})
        MLI1_1(i)=nan;
    else
        MLI1_1(i)=M{i,5};
    end
    
     %organize variable Lugaro (number of cells)
    if ischar(M{i,6})
        Lugaro(i)=nan;
    else
        Lugaro(i)=M{i,6};
    end
    
   %organize variable MLI1_2 (number of cells)
    if ischar(M{i,7})
        MLI1_2(i)=nan;
    else
        MLI1_2(i)=M{i,7};
    end
%  
  %organize variable MLI2 (number of cells)
    if ischar(M{i,8})
        MLI2(i)=nan;
    else
        MLI2(i)=M{i,8};
    end
    
  %organize variable Granule (number of cells)
    if ischar(M{i,10})
        Granule(i)=nan;
    else
        Granule(i)=M{i,10};
    end
 
     %organize variable Golgi2 (number of cells)
    if ischar(M{i,9})
        Golgi2(i)=nan;
    else
        Golgi2(i)=M{i,9};
    end
    
     %organize variable PC (number of cells)
    if ischar(M{i,13})
       PC(i)=nan;
    else
        PC(i)=M{i,13};
    end
    

   
   
   
end


%% plot all shit

color0=[27 192 255]./255; %Candelabrum color
color1=[74, 181, 89]./255; %Globular color
color4=[218 53 27]./255; 
color2=[193, 62, 178]./255;%awesome purple color
color5=[238 130 238]./255; % light pink for Lugaro 
color6=[177 179 182]./255; %Golgi 1 color
color7=[127 63 152]./255; %Golgi2 color
color8=[233 128 92]./255;% MLI2 color

color3=[0 0 0];

alphaColors=0.5;

figure('Renderer', 'painters', 'Position', [950 132 678 584])
subplot(3,2,1)
bar(Candelabrum./PC,'facecolor',color0)
title('Candelabrum')
xticks([1:numel(Candelabrum)])
xticklabels(Lobule)
ylabel('normalized count')
set(gca,'TickDir','out');
ylim([0 0.3])
box off

subplot(3,2,3)
bar(Globular./PC,'facecolor',color1)
title('Globular')
xticks([1:numel(Candelabrum)])
xticklabels(Lobule)
ylabel('normalized count')
set(gca,'TickDir','out');
ylim([0 0.3])
box off
 set(gca, 'FontName', 'Arial')


subplot(3,2,5)
bar(Lugaro./PC,'facecolor',color5)
title('Lugaro')
xticks([1:numel(Candelabrum)])
xticklabels(Lobule)
ylabel('normalized count')
set(gca,'TickDir','out');
ylim([0 0.3])
box off
xlabel('Cerebellar region')



subplot(3,2,2)
bar(Golgi1./PC,'facecolor',color6)
title('Golgi1')
xticks([1:numel(Candelabrum)])
xticklabels(Lobule)
ylabel('normalized count')
set(gca,'TickDir','out');
ylim([0 0.3])
box off


subplot(3,2,4)
bar(Golgi2./PC,'facecolor',color7)
title('Golgi2')
xticks([1:numel(Candelabrum)])
xticklabels(Lobule)
ylabel('normalized count')
set(gca,'TickDir','out');
ylim([0 0.3])
box off

subplot(3,2,6)
bar(MLI2./PC,'facecolor',color8)
title('MLI2')
xticks([1:numel(Candelabrum)])
xticklabels(Lobule)
ylabel('normalized count')
ylim([0 1.5])
set(gca,'TickDir','out');
box off
xlabel('Cerebellar region')




